﻿using System;
using System.Reflection;
using UnityEngine;

// Token: 0x02000003 RID: 3
public class BustGravityEx
{
	// Token: 0x06000007 RID: 7 RVA: 0x00002AC4 File Offset: 0x00000CC4
	public static void ReCalcEx(BustGravity that, int[] changePtn)
	{
		CharFemale charFemale = BustGravityEx.f_female.GetValue(that) as CharFemale;
		if (null == charFemale)
		{
			return;
		}
		CharFileInfoCustomFemale charFileInfoCustomFemale = BustGravityEx.f_customInfo.GetValue(that) as CharFileInfoCustomFemale;
		if (charFileInfoCustomFemale == null)
		{
			return;
		}
		if (changePtn.Length == 0)
		{
			return;
		}
		float num = Mathf.Clamp(charFileInfoCustomFemale.shapeValueBody[1], 0f, float.MaxValue) * Mathf.Clamp(charFileInfoCustomFemale.bustSoftness, 0f, float.MaxValue) * 0.5f;
		float[] array = BustGravityEx.f_range.GetValue(that) as float[];
		float y;
		if (charFileInfoCustomFemale.bustWeight < 0f)
		{
			y = (array[0] + (array[1] - array[0]) * charFileInfoCustomFemale.bustWeight) * num;
		}
		else if (charFileInfoCustomFemale.bustWeight > 1f)
		{
			y = (array[1] + (array[1] - array[0]) * (charFileInfoCustomFemale.bustWeight - 1f)) * num;
		}
		else
		{
			y = Mathf.Lerp(array[0], array[1], charFileInfoCustomFemale.bustWeight) * num;
		}
		DynamicBone_Ver02[] array2 = new DynamicBone_Ver02[]
		{
			charFemale.getDynamicBone(CharFemaleBody.DynamicBoneKind.BreastL),
			charFemale.getDynamicBone(CharFemaleBody.DynamicBoneKind.BreastR)
		};
		foreach (int ptn in changePtn)
		{
			foreach (DynamicBone_Ver02 dynamicBone_Ver in array2)
			{
				if (dynamicBone_Ver != null)
				{
					dynamicBone_Ver.setGravity(ptn, new Vector3(0f, y, 0f), true);
				}
			}
		}
	}

	// Token: 0x04000002 RID: 2
	private static FieldInfo f_female = typeof(BustGravity).GetField("female", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField);

	// Token: 0x04000003 RID: 3
	private static FieldInfo f_customInfo = typeof(BustGravity).GetField("customInfo", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField);

	// Token: 0x04000004 RID: 4
	private static FieldInfo f_range = typeof(BustGravity).GetField("range", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.GetField);
}
